﻿@model MileageStats.Web.Models.VehicleFormModel
@{
    Layout = "~/Views/Shared/_Layout.Mobile.cshtml";
    ViewBag.Title = "Edit Vehicle";
}
<nav>
    <ol class="title">
        <li><a href="@Url.Action("Index", "Dashboard")" class="dashboard icon only"><span>Dashboard</span></a></li>
        <li>Edit Vehicle</li>
    </ol>
</nav>
@{Html.RenderPartial("_Flash.Mobile");}
@using (var section = Mustache.Section("Model"))
{
    <div class="view">
        <form action="@Url.UnencodedAction("Edit", "Vehicle", new { vehicleId = Mustache.Value(m => m.VehicleId)})" method="POST">
            @{ Html.RenderPartial("~/Views/Vehicle/VehicleForm.Mobile.cshtml", Model); }
            <p class="instructions">
                Note: Year, Make and Model are optional.
            </p>            
        </form>
        <ol class="hbox button-group">
            <li class="icon false">
                @if (Request.Browser.IsWow())
                {
                    <form action="@Url.UnencodedAction("Delete", "Vehicle", new {id = Mustache.Value(m => m.VehicleId)})" id="DeleteVehicleForm" method="POST">
                        @Html.AntiForgeryToken()

                        <button id="DeleteVehicleButton" type="submit" value="delete" name="action">
                            <span>Delete vehicle</span></button>
                    </form>
                }
                else
                {
                    <form action="@Url.UnencodedAction("ConfirmDelete", "Vehicle", new {id = Mustache.Value(m => m.VehicleId)})" method="GET">
                        <button type="submit" value="delete" name="action" class="false">
                            <span>Delete vehicle</span></button>
                    </form>
                }
            </li>
        </ol>
    </div>
}